<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@include file="/commons/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<input id="CHECKMACHINECODE" value="NO" type="hidden" />
<input id="MACHINECODE" name="机器码" value="12jjkkj2334sfjgjs" type="hidden" />
<div class="row">
 <div class="col-md-7 col-md-offset-5" style="padding: 5px 5px 5px 15px;">
 	<label>医院名称:</label>
    <input id="NAME" class="form-control" type="text"style="width: 180px;" />
 </div>
  <div class="col-md-7 col-md-offset-5" style="padding: 5px 5px 5px 15px;">
 	<label>授权密钥：</label>
       <input id="LICENSECODE" class="form-control" type="text"style="width: 180px;"/>
 </div>
  <div class="col-md-7 col-md-offset-5" style="padding: 5px 5px 5px 15px;">
 	<label>失效日期:</label>
        <input id="EXPIREDAY" class="form-control" type="text"style="width: 180px;"/>
 </div>
  <div class="col-md-7 col-md-offset-5" style="padding: 5px 5px 5px 15px;">
 	<button id="createlicense" type="button" class="btn btn-success">生成授权文件</button
 </div>
</div>
<script type="text/javascript">   
   $(function(){
	   $('#'+tabId+' #EXPIREDAY').datetimepicker({
			format:"yyyy-mm-dd",
			autoclose : true,
			todayBtn : true,
			minView : 3,
			startView : 2,
			weekStart: 1,
			todayBtn: 1,
			autoclose: 1,
			todayHighlight: 1,
			forceParse: 0,
			showMeridian: 1,
			language : 'zh-CN'
			});
   });  
   $('#'+tabId+' #createlicense').on('click',function(){
	   if($("#NAME").val()==''){
		   drgUI.warning("医院名称不能为空！");	   
		   return;
	   }
	   if($("#LICENSECODE").val()==''){
		   drgUI.warning("授权密钥不能为空！");	   
		   return;
	   }
	   if($("#EXPIREDAY").val()==''){
		   drgUI.warning("失效日期不能为空！");	   
		   return;
	   }
		$.post(contextPath + "/CreateLicense/createLicense.dhc", {
			"NAME":$("#NAME").val(),
			"CHECKMACHINECODE":$("#CHECKMACHINECODE").val(),
			"MACHINECODE":$("#MACHINECODE").val(),
			"LICENSECODE":$("#LICENSECODE").val(),
			"EXPIREDAY":$("#EXPIREDAY").val()
		 }).done(function(data){
			if(data=='success'){
				 window.open("./download/drglicense/drgsLicense.lic");
				drgUI.success("授权文件已生成，请严格保密！");
			}else{
				drgUI.error(data);
			}
		});
   });
   
   </script>                     
</html>